<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/StaffTemplate.xhtml">

    <ui:define name="nav_menu">
        <f:view beforePhase="#{staffEditAccessRightsManagedBean.initView}">
            <p:menubar model="#{staffEditAccessRightsManagedBean.staffMenuModel}"/>
        </f:view>
    </ui:define>

    <ui:define name="content">
        <h:form>
            <p:dataTable var="staffAccountState" value="#{staffEditAccessRightsManagedBean.staffAccountState}" id="accessRightList">  

                <f:facet name="header">  
                    "#{bundle['staff.editAccessRights.header']}"
                </f:facet>  

                <p:column headerText="Account ID" style="width:300px">  
                    <h:outputText value="#{staffAccountState.id}" />  
                </p:column>  
                <p:column headerText="Username" style="width:300px">  
                    <p:cellEditor>  
                        <f:facet name="output">  
                            <h:outputText value="#{staffAccountState.username}" />  
                        </f:facet>  
                        <f:facet name="input">  
                            <h:inputText value="#{staffAccountState.username}" />  
                        </f:facet>  
                    </p:cellEditor>

                </p:column>  
                <p:column headerText="Creation Date" style="width:300px">  
                    <p:cellEditor>  
                        <f:facet name="output">  
                            <h:outputText value="#{staffAccountState.creationDate}" />   
                        </f:facet>  
                        <f:facet name="input">  
                            <h:inputText value="#{staffAccountState.creationDate}" />   
                        </f:facet>  
                    </p:cellEditor>

                </p:column> 
                <p:column headerText="Access Rights" style="width:300px">  
                    <p:cellEditor>  
                        <f:facet name="output">  
                            <p:dataList value="#{staffAccountState.accessRights}" var="accessRights">  
                                #{accessRights.accessRight} 
                            </p:dataList>  
                        </f:facet>  
                        <f:facet name="input">  
                            <h:selectManyCheckbox layout="pageDirection" required="true" requiredMessage="Access Rights is required." id="accessRights" value="#{staffAccountState.accessRights}" converter="accessRightsConverter" >
                                <f:selectItems value="#{staffEditAccessRightsManagedBean.accessRightSelectItems}"/>
                            </h:selectManyCheckbox>
                        </f:facet>  
                    </p:cellEditor>
                </p:column>  
                <p:column headerText="Edit">  
                    <p:rowEditor />
                </p:column>  
            </p:dataTable>  
        </h:form>
    </ui:define>
</ui:composition>
